package com.yc.eduservice.controller;

import com.hz.apiservice.model.request.ApiResponse;
import com.yc.eduservice.service.TeacherService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/edu/teacher")
public class TeacherController {
    @Resource
    TeacherService teacherService;
    @PostMapping("/check-score")
    public String checkScore(@RequestParam("courseId") int courseId, @RequestParam("studentId") int studentId, @RequestParam("userScore") int userScore) {
        int check=teacherService.checkScore(courseId, studentId, userScore);
        return check>0? ApiResponse.ok(check):ApiResponse.intError();
    }
}
